package com.trkj.service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.trkj.dao.jpa.IJlJlCheckPayDAO;
import com.trkj.pojos.JlCheckPay;


@Service
@Transactional
public class JlJlCheckPayService {
	@Autowired
	private IJlJlCheckPayDAO CheckPayDAO;
	/*
	 * 查看信息
	 */
	public Map<String, Object> finCheckPaypage(int page, int rows){
		PageRequest pr = new PageRequest(page - 1, rows);
		//获取当前页的记录
		List<JlCheckPay> list = CheckPayDAO.finCheckPaypage(pr);
		//获取总的记录条数
		long total = CheckPayDAO.count();
		
		Map<String, Object> map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	//添加电子处方总表信息
		public void  addJlCheckPaypage(String cpFigurePerson, Date cpDate, BigDecimal cpNum,BigDecimal icpId){
			JlCheckPay ElectronicePrint=new JlCheckPay();
			ElectronicePrint.setCpFigurePerson(cpFigurePerson);
			ElectronicePrint.setCpDate(cpDate);
			ElectronicePrint.setCpNum(cpNum);
			ElectronicePrint.setIcpId(icpId);
			CheckPayDAO.save(ElectronicePrint);
		}
		public List<JlCheckPay> icJlCheckPay(BigDecimal irpId){
			return CheckPayDAO.icJlCheckPay(irpId);
		}
}
